
#ifndef __FILEHEADER_H__
#define __FILEHEADER_H__

#include "irrTypes.h"
#include "IReadFile.h"

#define MAX_FILES_ALLOWED	(1024)

class FileHeader
{
private:		
	irr::u32		m_offsetsArray[MAX_FILES_ALLOWED];
	irr::u32		m_filesNumber;

public:
	FileHeader() : m_filesNumber(0) {};
	~FileHeader() {};
	
	int LoadHeader(irr::io::IReadFile *pResource, irr::u32 baseOffset = 0);	

	inline int GetNumber()
	{
		return m_filesNumber;
	}

	inline irr::u32 GetSize(irr::u32 id)
	{
		if (id >= m_filesNumber)
			return 0;
		return (m_offsetsArray[id + 1] - m_offsetsArray[id]);
	}

	inline irr::u32 GetOffset(irr::u32 id)
	{
		if (id >= m_filesNumber)
			return 0;
		return m_offsetsArray[id];
	}
};

#endif //__FILEHEADER_H__